package cn.jobstart.service;

import cn.jobstart.modelExt.RightsExt;
import cn.jobstart.searchExt.RightsSearchExt;
import cn.jobstart.pubInter.IBaseService;
import cn.jobstart.pubInter.exception.SkException;
import java.util.List;

/**
*    @author sunke
*    @Date 2023-09-06 15:00:21
*    @description RightsService      权限表
*/
public interface IRightsService extends IBaseService<RightsExt, RightsSearchExt,String> {

    /**
     * 树型
     * @param level  需要几级数据
     * @return
     */
    List<RightsExt> tree(int level);

    /**
     * 得到所有
     *
     * @return
     */
    List<RightsExt> getTopList();


    /**
     * 得到用户所有上级
     *
     * @param rightsId
     * @param self     是否要包括自己
     * @return
     */
    List<RightsExt> getUpListByRightsId(String rightsId, boolean self);


    /**
     * 得到的下级树结构
     *
     * @param rightsId
     * @return
     * @throws SkException
     */
    RightsExt treeByRightsId(String rightsId, int level) throws SkException;

    /**
     * 更新所有下级等级
     *
     * @param rightsId
     * @param currentRightsLevel
     * @param upSelf             是否更新自己
     */
    void updateAllSubLevelByRightsId(String rightsId, int currentRightsLevel, boolean upSelf);

    void updateAllSubLevelByRights(RightsExt rights, int currentRightsLevel, boolean upSelf);

    /**
     * 权限的下级
     *
     * @param rights
     * @throws SkException
     */
    void treeByRights(RightsExt rights, int level);

    /**
     * 得到某一个权限的下一级权限
     *
     * @param rightsId
     * @return
     * @throws SkException
     */
    List<RightsExt> getSubListByRightsId(String rightsId) throws SkException;

    /**
     * 得到顶级权限
     *
     * @param rightsId
     * @return
     * @throws SkException
     */
    RightsExt getTopRightsByRightsId(String rightsId) throws SkException;
}